package leetcode_周赛._2021._202105._20210530;

/**
 * @author yzh
 * @version 1.0
 * @date 2021/5/30 10:31
 * 检查某单词是否等于两单词之和
 * 算啊：字符串
 */
public class _5772 {

    public boolean isSumEqual(String firstWord, String secondWord, String targetWord) {
        long a = 0, b = 0, target = 0;
        for (int i = 0; i < firstWord.length(); i++) {
            char c = firstWord.charAt(i);
            if (i == 0 && c == 'a') continue;
            a = a * 10 + (c - 'a');
        }
        for (int i = 0; i < secondWord.length(); i++) {
            char c = secondWord.charAt(i);
            if (i == 0 && c == 'a') continue;
            b = b * 10 + (c - 'a');
        }
        for (int i = 0; i < targetWord.length(); i++) {
            char c = targetWord.charAt(i);
            if (i == 0 && c == 'a') continue;
            target = target * 10 + (c - 'a');
        }
        return  a + b == target;
    }

}
